11 pages, 10 Figures, 5 TablesInternational audienceWe describe a wide and deep search for optical GRB afterglows on images taken with MegaCAM at the Canada France Hawaii Telescope, within the framework of the CFHT Legacy Survey. This search is performed in near real-time thanks to a Real Time Analysis System called "Optically Selected GRB Afterglows", which has been completely realized and installed on a dedicated computer in Hawaii. This pipeline automatically and quickly analyzes Megacam images and extracts from them a list of astrometrically and photometrically variable objects which are displayed on a web page for validation by a member of the collaboration. In this paper, we comprehensively describe the RTAS process. We also present s...